<template>
  <div class="about">
    <div class="head">
      <div class="top">
        <i class="iconfont icon-erweima"></i>
        <i class="iconfont icon-quanjushezhi"></i>
      </div>
      <div v-if="!islogin">
        <div class="headicon">
          <i class="iconfont icon-user-full"></i>
        </div>
        <p class="login"><span @click="login">点击登录</span></p>
      </div>
      <div class="logined" v-if="islogin">
        <div class="headicon">
          <img src="../../public/assets/jkl.jpg" alt="" />
        </div>
        <div class="user">
          <p class="nickname">Eason</p>
          <p class="userinfo">未填写城市、职业信息</p>
        </div>
        <div class="ele">个人主页</div>
      </div>
      <div class="option" v-if="islogin">
        <div class="item">
          <p class="count">0</p>
          <p class="title">粉丝</p>
        </div>
        <div class="item" @click="$router.push({ path: '/attention' })">
          <p class="count">{{ attention.length }}</p>
          <p class="title">关注</p>
        </div>
        <div class="item">
          <p class="count">0</p>
          <p class="title">收藏</p>
        </div>
      </div>
    </div>
    <div class="vipbox">
      <div class="vip">
        <div class="img">
          <img src="../../public/assets/svip.png" alt="" />
        </div>
        <div class="midd">
          <p class="kaitong">开通新片场VIP</p>
          <p class="mianfei">享免费课程、高效合作</p>
        </div>
        <p class="tequan">了解特权</p>
        <div class="right">
          <i class="iconfont icon-youjiantou"></i>
        </div>
      </div>
    </div>
    <div class="chuangzuo">
      <div class="top">
        <p class="czzx">创作中心</p>
        <p class="cgx">草稿箱</p>
      </div>
      <div class="content">
        <div class="box">
          <p>发布公开作品</p>
          <span>分享你的个人作品</span>
        </div>
        <div class="box">
          <p>上传私密视频</p>
          <span>加密分享、高清播放</span>
        </div>
      </div>
    </div>
    <div class="itembox">
      <div @click="logout" class="item" v-if="islogin">
        <p>退出登录</p>
      </div>
      <div class="item">
        <p>传输列表</p>
      </div>
      <div class="item">
        <p>会员中心</p>
      </div>
      <div class="item">
        <p>我的课程</p>
      </div>
      <div class="item">
        <p>优惠券</p>
      </div>
      <div class="item">
        <p>我的订单</p>
      </div>
      <div class="item">
        <p>作品通</p>
        <div class="tj">推荐</div>
        <span class="zpt">好作品应该被更多人看见</span>
      </div>
      <div class="item">
        <p>我的手记</p>
      </div>
    </div>
    <div class="bottom">
      <p>新片场认证</p>
    </div>
  </div>
</template>
<script>
import { Dialog } from 'vant';
export default {
  data() {
    return {
      islogin: 0,
      attention: [],
    };
  },
  created() {
    this.islogin =
      this.$route.query.login * 1 ||
      JSON.parse(window.localStorage.getItem("logined")) ||
      0;
    this.attention =
      JSON.parse(window.localStorage.getItem("attentionList")) || [];
  },
  methods: {
    login() {
      this.$router.push({ path: "/loginreg" });
    },
    logout() {
      Dialog.confirm({
        title: "是否退出登录",
        // message: "弹窗内容",
      })
        .then(() => {
          window.localStorage.setItem('logined',0)
          this.islogin =JSON.parse(window.localStorage.getItem("logined"))
        })
        .catch(() => {
          // on cancel
        });
    },
  },
};
</script>

<style lang="less" scoped>
.about {
  width: 100%;
  overflow: hidden;
  background-color: #f7f7f7;
  .head {
    width: 100vw;
    padding: 10px 0px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    background-color: #fff;
    margin-bottom: 20px;
    overflow: hidden;
    .option {
      width: 100%;
      display: flex;
      justify-content: space-around;
      border-top: 1px solid #f0f0f0;
      padding-top: 20px;
      .item {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        position: relative;
        .count {
          font-weight: 600;
          font-size: 18px;
        }
        .title {
          font-size: 14px;
          margin-top: 4px;
          color: #888;
        }
        &::after {
          content: "|";
          position: absolute;
          right: -51px;
          color: #f0f0f0;
          font-size: 22px;
        }
        &:last-child {
          &::after {
            content: "";
          }
        }
      }
    }
    .top {
      width: 100%;
      display: flex;
      justify-content: flex-end;
      padding: 0 10px;
      i {
        font-size: 36px;
      }
    }
    .logined {
      width: 100vw;
      display: flex;
      align-items: center;
      margin: 30px 0;
      overflow: hidden;
      .headicon {
        margin: 0 20px;
      }
      .ele {
        padding: 4px 14px;
        border-radius: 16px 0 0 16px;
        background-color: #fc2d47;
        color: white;
        font-size: 14px;
        position: absolute;
        right: 0px;
      }
      .user {
        .nickname {
          color: #000;
          font-weight: 600;
          font-size: 18px;
        }
        .userinfo {
          color: #888;
          margin-top: 5px;
          font-size: 14px;
        }
      }
    }
    .headicon {
      margin-top: 30px;
      width: 70px;
      height: 70px;
      border-radius: 50%;
      overflow: hidden;
      background-color: #e4e4e4;
      display: flex;
      justify-content: center;
      align-items: center;
      i {
        font-size: 60px;
        color: #fff;
        margin-top: 10px;
      }
    }
    .login {
      width: 100%;
      font-size: 18px;
      text-align: center;
      margin-top: 20px;
      margin-bottom: 30px;
      font-weight: 600;
    }
  }
  .vipbox {
    width: 100%;
    background-color: #fff;
    height: 80px;
    padding: 15px 20px;
    .vip {
      display: flex;
      align-items: center;
      border-radius: 10px;
      padding: 0 15px;
      width: 100%;
      height: 100%;
      background-image: linear-gradient(to right, #000, #3d3d3d);
      .img {
        width: 35px;
        height: 35px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: #5a5a5a;
        margin-right: 15px;
        img {
          width: 25px;
          height: 25px;
        }
      }
      .midd {
        flex: 1;
        .kaitong {
          color: #af8c8a;
          font-size: 17px;
        }
        .mianfei {
          font-size: 14px;
          color: #888;
        }
      }
      .tequan {
        color: white;
        font-size: 14px;
        margin-right: 5px;
      }
      .right {
        width: 17px;
        height: 17px;
        background-color: #fff;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        i {
          font-size: 14px;
          margin-bottom: 2px;
          font-weight: 600;
        }
      }
    }
  }
  .chuangzuo {
    padding: 20px;
    padding-bottom: 25px;
    .top {
      display: flex;
      justify-content: space-between;
      align-items: center;
      .czzx {
        font-size: 18px;
        font-weight: 600;
      }
      .cgx {
        font-weight: 600;
      }
    }
    .content {
      display: flex;
      justify-content: space-between;
      margin-top: 15px;
      .box {
        width: 48%;
        height: 66px;
        background-color: #fff;
        border-radius: 5px;
        box-shadow: 0 0 8px 2px #ddd;
        display: flex;
        flex-wrap: wrap;
        align-content: space-around;
        justify-content: center;
        p {
          font-size: 17px;
          font-weight: 600;
        }
        span {
          font-size: 14px;
          color: #c2c2c2;
        }
      }
    }
  }
  .itembox {
    width: 100%;
    background-color: #fff;
    padding: 0 20px;
    .item {
      height: 70px;
      display: flex;
      align-items: center;
      border-bottom: 1px solid #f7f7f7;
      p {
        font-size: 18px;
        font-weight: 600;
      }
      .tj {
        outline: 0.5px solid #e55549;
        color: #e55549;
        font-size: 12px;
        line-height: 12px;
        padding: 2px;
        margin-left: 15px;
        font-weight: 300;
        border-radius: 2px;
      }
      .zpt {
        flex: 1;
        text-align: right;
        font-size: 14px;
        color: #e55549;
        font-weight: 600;
      }
    }
  }
  .bottom {
    width: 100%;
    height: 100px;
    background-color: #fff;
    margin-top: 20px;
    padding: 0 20px;
    padding-top: 20px;
    margin-bottom: 60px;
    p {
      font-size: 18px;
      font-weight: 600;
    }
  }
}
</style>